package fristphase.day02;

import java.util.Scanner;

public class 加法运算器 {
    public static void main(String[] args) {
        int correct =0;
        for(int i=0;i<10;i++){
            int num1 = (int)(Math.random()*99+1);
            int num2 = (int)(Math.random()*99+1);
            int result = num1 + num2;
            Scanner scanner = new Scanner(System.in);
            System.out.println(num1+"+"+num2);
            System.out.println("请输入答案：");
            int userNum = scanner.nextInt();
            if(userNum == result){
                System.out.println("恭喜你答对了");
                correct++;
            }else {
                System.out.println("请输入正确答案");
            }
        }
        System.out.println("你总共答对"+correct+"道题");
    }
}
